#!/bin/sh

#APP_NAME=lrtEmail.jar
#echo $APP_NAME
#tokill=`ps -ef | grep java | grep $NAME | awk '{print $2}'`
#kill -9 $tokill
#echo "success"

echo "kill start..."
PID=$(lsof -i:8888|grep java|awk '{print $2}')

if [ -z $PID ]; then
	echo "process not exist"
else
	echo "process id: $PID"
	kill -15 $PID
	# 用于监听pid是否被杀死的，可以阻塞代码执行
	tail --pid=$PID -f /dev/null
	echo "process be killed"
fi

nohup java -jar healthCode-001.jar --spring.profiles.active=pro >> ./healthCode-001.log 2>&1 &

echo "stared success"